/* 
 * File:   BookingData.cpp
 * Author: Neo Siong Wei
 * 
 * Created on February 11, 2014, 7:11 PM
 */
#include "BookingData.h"

BookingData::BookingData() {
}

BookingData::BookingData(int t_ID, string t_Status, string t_UID, PackageData t_PD, 
                string t_Add, string t_Town, string t_City, string t_Postal, 
                string t_FName, string t_LName, string t_Title, 
                long t_FDate, long t_SDate, string t_Spec, long t_BDate){
    
    bookingID = t_ID;
    status = t_Status;
    userID = t_UID;
    PD = t_PD;
    add = t_Add;
    town = t_Town;
    city = t_City;
    postal = t_Postal;
    fName = t_FName;
    lName = t_LName;
    title = t_Title;
    fDate = t_FDate;
    sDate = t_SDate;
    special = t_Spec;
    bDate = t_BDate;
}

BookingData::~BookingData() {
}

int BookingData::getPD_ID(){
    return PD.getPackID();
}
char BookingData::getPD_pType(){
    return PD.getPType();
}
string BookingData::getPD_DestName(){
    return PD.getDestName();
}
int BookingData::getPD_hType(){
    return PD.getHType();
}
int BookingData::getPD_capacity(){
    return PD.getCapacity();
}
int BookingData::getPD_cost(){
    return PD.getCost();
}
int BookingData::getBookingID(){
    return bookingID;
}
string BookingData::getStatus(){
    return status;
}
string BookingData::getUserID(){
    return userID;
}
string BookingData::getFullAddress(){
    return add + " " + town + " " + city + " " + postal;
}
string BookingData::getAdd (){
    return add;
}
string BookingData::getTown (){
    return town;
}
string BookingData::getCity (){
    return city;
}
string BookingData::getPostal(){
    return postal;
}
string BookingData::getFullName(){
    return title + " " + fName + " " + lName;
}
string BookingData::getTitle (){
    return title;
}
string BookingData::getFName (){
    return fName;
}
string BookingData::getLName (){
    return lName;
}
long BookingData::getFDate(){
    return fDate;
}
long BookingData::getSDate(){
    return sDate;
}
string BookingData::getSpecial(){
    return special;
}
long BookingData::getBDate(){
    return bDate;
}

void BookingData::setAddress(string address, string t, string c, string p){
    add = address;
    town = t;
    city = c;
    postal = p;
}
void BookingData::setUserID(string user){
    userID = user;
}
void BookingData::setFullName(string title, string first, string last){
    this -> title = title;
    fName = first;
    lName = last;
}
void BookingData::setStatus(string stat){
    status = stat;
}
void BookingData::setBookingID(int bID){
    bookingID = bID;
}
void BookingData::setFDate(long fDate){
    this -> fDate = fDate;
}
void BookingData::setSDate(long sDate){
    this -> sDate = sDate;
}
void BookingData::setSpecial(string spec){
    special = spec;
}
void BookingData::setBDate(long bDate){
    this -> bDate = bDate;
}

ostream& operator<< (ostream &out, BookingData &BD){
    out << "| View Booking |" << endl;
    out << endl;
    out << "-----------------------------------------------------------" << endl;
    out << "\tBooking Status: " << BD.getStatus() << endl;
    out << "-----------------------------------------------------------" << endl;
    out << endl;
    
    char *ptr = &BD.getUserID()[0];
    if (*ptr == 'C'){
    out << "\t| User Particulars |" << endl;
    out << "User ID: " << BD.getUserID() << "\t\tName: " << BD.getFullName() << endl;
    out << "Full Address: " << BD.getFullAddress() << endl;
    out << "-----------------------------------------------------------" << endl;
    out << endl;
    }
    
    out << "\t| Booking & Package Information |" << endl;
    out << "Booking ID: " << BD.getBookingID() << "\t\tPackage ID: " << BD.getPD_ID() << endl;
    out << "Destination: " << BD.getPD_DestName();
    out << "\t\tTrip Duration: ";
    
    switch(BD.getPD_hType()){
        case 0: out << "3Days 2Night." << endl;
            break;
        case 1: out << "7Days 6Night." << endl;
            break;
        case 2: out << "14Days 13Night." << endl;
            break;
        default: out << "28Days 27Night." << endl;
    }
    out << endl;
    out << "-----------------------------------------------------------" << endl;
    out << "Price: $" << BD.getPD_cost() << endl;
}